https://leetcode.cn/problems/find-pivot-index/submissions/671974517/

class Solution {
public:
	int pivotIndex(vector<int>& nums) {
		int len=nums.size();
		int sum=0;
		for(int i=0;i<len;i++){
			sum+=nums[i];
		}
		int s=0;
		for(int i=0;i<len;i++){
			if(s==(sum-nums[i])/2&&(sum-nums[i])%2==0) return i;
			s+=nums[i];
		}
		return -1;
	}
};
